package BigDecimal;

import java.math.BigDecimal;
import java.math.RoundingMode;

public class Test {
    /*
    掌握BigDecimal方法的使用
     */

    public static void main(String[] args) {
        System.out.println(BigDecimal.valueOf(1).add(BigDecimal.valueOf(0.1)));
        System.out.println("==========");
        System.out.println(BigDecimal.valueOf(1.0).subtract(BigDecimal.valueOf(0.1)));
        System.out.println("==========");
        System.out.println(BigDecimal.valueOf(1.015).multiply(BigDecimal.valueOf(100)));
        System.out.println("==========");
        System.out.println(BigDecimal.valueOf(1.301).divide(BigDecimal.valueOf(100)));
        System.out.println("==========");
        BigDecimal divide = BigDecimal.valueOf(1).divide(BigDecimal.valueOf(3), 2, RoundingMode.HALF_UP);
        System.out.println(divide);
    }
}
